import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../views/Layout/Index.vue'
import Login from '../views/Login/Login.vue'
import Home from '../views/Home/index.vue'
import Goods from '../views/Goods/Goods.vue'
// import Category from "../views/Category/Category.vue";

const Params = () => import('../views/Params/Params.vue')
const Order = () => import('../views/Order/Order.vue')
const OrderList = () => import('../views/Order/OrderList/index.vue')
const OrderQuit=()=>import('../views/Order/OrderQuit/index.vue')
const Rent=()=>import('../views/Rent/Rent.vue')
const Echars=()=>import('../views/Echars/Echars.vue')
const Callme=()=>import('../views/CallMe/Callme.vue')
const TalkRoom=()=>import('../views/TalkRoom/Talkroom.vue')
// const Category=()=>import('../views/Category/Category.vue')
const UpdatePassWord=()=>import('../views/Person/UpdatePassword.vue')
Vue.use(Router)
// src/router/index.js
const VueRouterPush = Router.prototype.push
Router.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}


export default new Router({
  routes: [
    {
      path: '/', component: Layout,
      children: [
        {
          path: '/',
          name: 'Home',
          component: Home
        },
        {
          path: '/goods',
          name: 'goods',
          component: Goods
        },
        {
          path: '/params',
          name: 'params',
          component: Params
        },
        {
          path: '/order',
          name: 'order',
          component: Order,
          redirect:'/order/orderlist',
          children: [
            {
              path: 'orderlist',
              component: OrderList
            },
            {
              path:'orderquit',
              component:OrderQuit
            }
          ]
        },
        {
          path:'/rent',
          name:"rent",
          component:Rent
        },
        {
          path:'/echars',
          name:'echars',
          component:Echars
        },
        {
          path:'/callme',
          component:Callme
        },
        {
          path:'/talkroom',
          component:TalkRoom
        },
        {path:'/Category',
          component:()=>import('../views/Category/Category')},
        {
          path:'/update-password',component:UpdatePassWord
        },
        {
          path:'/link',component:()=>import('../views/Person/Link.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'Login',
      component:
        Login
    }

  ]
})
